home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / dbase / techs.zip / TECH23.ZIP / PORTSWAP.ASM next >
Assembly Source File  |  1985-10-29  |  2KB  |  65 lines

  1.           .LFCOND ; List false conditionals.
  2.           PAGE 60,132 ; Page length 60, line 132.
  3.  
  4. COM EQU 0                        ; Assemble as .BIN file
  5. D3 EQU 1                         ; for Developer's Release.
  6. ;
  7. CODESEG SEGMENT BYTE PUBLIC 'CODE'
  8.           ASSUME     CS:CODESEG
  9. ;
  10. PORTSWAP PROC    FAR
  11. ;
  12.           IF COM
  13.                ORG        0100H        ; Originate at 0100H. 
  14.           ENDIF
  15. ;
  16. START: PUSH ES ; Save environment.
  17.           PUSH        AX
  18.           PUSH        BX
  19.           PUSH        DI
  20. ;        
  21.            MOV         AX,40H     ; System stores critical operating
  22.                                      ; parameters at segment 40H (absolute
  23.                                      ; address 400H).
  24.                                      ; Load this segment address into AX.
  25.           PUSH         AX            ; Put it on the stack.
  26.           POP         ES         ; Pop the segment id from the
  27.                              ; stack into extra segment register.  
  28.           MOV         DI,8H        ; Port address of LPT1 and LPT2 are
  29.                                      ; stored at offsets 8H and 0AH in
  30.                                     ; this segment.  Load DI with offset.
  31.           MOV         AX,ES:[DI] 
  32.                                     ; Put the port address of the
  33.                            ; first printer into the accumulator.
  34.           INC         DI            ; Increment the destination index 
  35.                                      ; twice to point to port address
  36.            INC         DI         ; of the second printer.  
  37.           MOV         BX,ES:[DI] 
  38.                                     ; Put the port address of the
  39.                                      ; second printer into BX.
  40.            MOV         ES:[DI],AX
  41.                                     ; Poke the address of the first
  42.                                      ; printer into the location of the 
  43.                                      ; second printer.
  44.            DEC         DI            ; Decrement DI twice to point to the
  45.            DEC         DI         ; location of the first printer
  46.                                     ; port address.
  47.            MOV         ES:[DI],BX 
  48.                                     ; Poke the address of the second
  49.                                     ; printer into the location of the
  50.                                      ; first.
  51.           POP         DI         ; Restore environment.
  52.           POP           BX
  53.           POP           AX
  54.           POP           ES
  55.  
  56.           IF           COM
  57.              INT 20H             ; INT 20H if .COM file
  58.           ELSE
  59.              RET                     ; far return to dBASE III 
  60.           ENDIF 
  61. ;
  62. PORTSWAP ENDP
  63. CODESEG  ENDS
  64.             END       START
  65.